<?php
require_once('header.php');
?>

<form action="<?php echo base_url('firstPage/listResult')?>" method="get" name="list">
	<div style="display: table;width: 100%;">
		<div style="float: left"><a href="<?=base_url('/firstPage/add');?>">创建文章</a></div>
		<div style="float: right">
			<input type="text" name="title"  placeholder=" 搜索文章" value="<?php echo isset($title)?$title:'';?>"/>
			<input type="hidden" name="searchKey" value="1"/>
			<input type="submit" name="submit" class="btn btn-default" value="搜索"/>
		</div>
	</div>
</form>

<ul class="nav nav-tabs">
	<li role="presentation" class="active"><a href="<?php echo base_url('firstPage/listResult');?>">文章管理</a></li>
	<li role="presentation"><a href="<?php echo base_url('firstPage/userList');?>">用户管理</a></li>
</ul>
<br/>
	<?php echo form_open(base_url('firstPage/add?id='.(isset($id)?$id:'')));?>
	<button type="submit" class="btn btn-default">保存</button>

	<br/><br/>
		<div class="form-group">
			<label for="title">标题:</label>
			<input type="text" id="title" name="title" value=" <?php echo isset($result['title'])?$result['title']:set_value('title'); ?>"/>
			<span id="title_err"><?php echo form_error('title');?></span>
			&nbsp;&nbsp;
			<label id="author">作者:</label> <span><?php echo isset($result['author'])?$result['author']:$username;?></span>
		</div>
		<div class="form-group">
			<label for="content">内容:</label>
			<span id="content_err"><?php echo form_error('content');?></span>

			<!-- 加载编辑器的容器 -->
			<script id="container" name="content" type="text/plain">
				<?php echo isset($result['content'])?$result['content']:set_value('content');?>
			</script>
		</div>
		<input type="hidden" name="eId" value="<?php echo isset($eid)?$eId:0;?>"/> <!--用于判断添加还是修改-->

	</form>

<!-- 配置文件 -->
<script type="text/javascript" src="<?php echo base_url('application/public/ueditor1_4_3-utf8/ueditor.config.js')?>"></script>
<!-- 编辑器源码文件 -->
<script type="text/javascript" src="<?php echo base_url('application/public/ueditor1_4_3-utf8/ueditor.all.js')?>"></script>
<!-- 实例化编辑器 -->
<script type="text/javascript">
	var editor = UE.getEditor('container');
</script>

<?php include('foot.php');?>
